package com.chixing.service.impl;

import com.chixing.mapper.OrderDetailMapper;
import com.chixing.pojo.CartExample;
import com.chixing.pojo.OrderDetail;
import com.chixing.pojo.OrderDetailExample;
import com.chixing.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderDetailImpl implements OrderDetailService {
    @Autowired
    private OrderDetailMapper orderDetailMapper;

    @Override
    public boolean save(OrderDetail orderDetail) {
        Integer rows = orderDetailMapper.insert(orderDetail);
        return rows > 0;
    }

    @Override
    public List<OrderDetail> selectByOrderNum(String orderNo) {


        OrderDetailExample orderDetailExample = new OrderDetailExample();
        OrderDetailExample.Criteria criteria = orderDetailExample.createCriteria();
        criteria.andOrderNoEqualTo(orderNo);

        return orderDetailMapper.selectByExample(orderDetailExample);
    }
}
